package day230902;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author 兴趣使然黄小黄
 * @version 1.0
 * @date 2023/9/2 19:16
 * 小美的子序列 100%
 */
public class Main02 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextInt()) {
            int n = in.nextInt();
            int m = in.nextInt();
            String[] input = new String[n];
            for (int i = 0; i < n; i++) {
                input[i] = in.next();
            }
            boolean flag = check(input);
            if (flag) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
        in.close();
    }

    private static boolean check(String[] input) {
        if (input.length < 7) {
            return false;
        }
        boolean ret = true;
        // 找到包含 meituan 且符合条件的最小行
        int[] myIndex = new int[7]; // myIndex[0] 表示 m 出现的行最小值
        Arrays.fill(myIndex, Integer.MAX_VALUE);
        for (int i = 0; i < input.length; i++) {
            if (myIndex[0] > i && input[i].contains("m")) {
                myIndex[0] = i;
            }
            if (myIndex[1] > i && input[i].contains("e") && i > myIndex[0]) {
                myIndex[1] = i;
            }
            if (myIndex[2] > i && input[i].contains("i") && i > myIndex[1]) {
                myIndex[2] = i;
            }
            if (myIndex[3] > i && input[i].contains("t") && i > myIndex[2]) {
                myIndex[3] = i;
            }
            if (myIndex[4] > i && input[i].contains("u") && i > myIndex[3]) {
                myIndex[4] = i;
            }
            if (myIndex[5] > i && input[i].contains("a") && i > myIndex[4]) {
                myIndex[5] = i;
            }
            if (myIndex[6] > i && input[i].contains("n") && i > myIndex[5]) {
                myIndex[6] = i;
            }
        }
        // 检验是否严格递增
        int slow = 0;
        int fast = 1;
        while (fast < myIndex.length) {
            if (myIndex[fast] <= myIndex[slow]) {
                ret = false;
                break;
            }
            slow++;
            fast++;
        }
        return ret && myIndex[6] != Integer.MAX_VALUE;
    }
}
